package com.ali.controller;

import com.ali.common.Response;
import com.ali.dto.PayInfo;
import com.ali.service.PayService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/pay")
public class PayController {
    @Resource
    private PayService payService;

    /**
     * 查询
     */
    @GetMapping(value = "/query")
    public Response<List<PayInfo>> query(@RequestParam Map<String, Object> param) {
        return payService.query(param);
    }

    /**
     * 超时
     */
    @GetMapping(value = "/timeout")
    public Response<String> timeout() {
        return payService.timeout();
    }

    /**
     * 控制
     */
    @GetMapping(value = "/control")
    public Response<String> control(@RequestParam Map<String, Object> param) {
        return payService.control(param);
    }

    /**
     * 打印
     */
    @GetMapping(value = "/print")
    public Response<String> print(@RequestParam Map<String, Object> param, @RequestHeader Map<String, Object> header) {
        return payService.print(param, header);
    }

    /**
     * 增加
     */
    @PostMapping(value = "/add")
    public Response<String> add(@RequestBody Map<String, Object> param) {
        return payService.add(param);
    }
}
